package com.czy.basecommon.utils.base;

import android.app.Activity;
import android.app.Application;
import android.content.Intent;
import android.os.Bundle;


import androidx.annotation.NonNull;
import androidx.lifecycle.AndroidViewModel;

import com.czy.basecommon.utils.tools.ActivityTool;
import com.czy.basecommon.utils.tools.TUtil;
import com.rxjava.rxlife.ScopeViewModel;


/**
 * @author：tqzhang on 18/7/26 16:15
 */
public class BaseViewModel<T extends BaseRepository> extends AndroidViewModel {


    private  Activity lastActivity;
    public T mRepository;

    public BaseViewModel(@NonNull Application application) {
        super(application);
         lastActivity = ActivityTool.getInstance().getLastActivity();

        mRepository = TUtil.getNewInstance(this, 0);
    }


    @Override
    protected void onCleared() {
        super.onCleared();
        if (mRepository != null) {
            mRepository.unDisposable();
        }


    }



}
